import request from "@/utils/request";
import type { classAllResponseData, classInfoData, classListFormData, classResponseData,classListResponseData } from "./type";
//@ts-ignore
enum API{
    CLASS_ALL_URL="/manage/class/all",
    CLASS_LIST_URL="/manage/class/list",
    CLASS_ADD_URL="/manage/class/add",
    CLASS_GET_ID_URL="/manage/class/find",
    CLASS_UPDATE_URL="/manage/class/update",
    CLASS_DELETE_URL="/manage/class/delete"
}

// 获取所有班级
export const reqClassAll=()=>request.get<any,classAllResponseData>(API.CLASS_ALL_URL)
//分页获取班级
export const reqClassList=(data:classListFormData)=>request.post<any,classListResponseData>(API.CLASS_LIST_URL,data)
// 添加班级
export const reqClassAdd=(data:classInfoData)=>request.post<any,classResponseData>(API.CLASS_ADD_URL,data)
//根据id查询班级
export const reqClassById=(_id:string)=>request.get<any,classResponseData>(API.CLASS_GET_ID_URL+`?_id=${_id}`)
// 更新班级信息
export const reqClassUpdate=(data:classInfoData)=>request.post<any,classResponseData>(API.CLASS_UPDATE_URL,data)
//删除班级
export const reqClassDelete=(classId:string)=>request.post<any,classResponseData>(API.CLASS_DELETE_URL,{classId})